package test;
import java.util.*;
public class gj1 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        int x=scan.nextInt();
        int d=scan.nextInt();
        int[] a=new int[x];
        for(int i=0;i<x;i++){
            a[i]=scan.nextInt();
        }
        Set<Integer>set=new HashSet<>();
        for (int i = 0; i < x; i++) {
            if(!set.contains(a[i])) set.add(a[i]+d);
        }
        System.out.println(set.size());
        scan.close();
    }
}
